Skip to content

Conversation

ritesh-3822
Copy link

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

📘 Description

Implemented the Josephus problem using recursion in Java, following the style of other algorithms in the repository.

🧩 Files Added

  • Josephus.java → recursive implementation in com.thealgorithms.recursion
  • JosephusTest.java → comprehensive JUnit 5 test class

✅ Features

  • Handles edge cases (n <= 0, k <= 0)
  • Prints survivor position using printJosephus
  • Includes demo main method
  • 100% test coverage with clear assertions

🧑‍💻 Author

@ritesh-3822

@ritesh-3822 ritesh-3822 marked this pull request as ready for review October 11, 2025 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant